using ProductService.Domain.Models;
using SharedKernel.Domain.Events;

namespace ProductService.Domain.Events
{
    /// <summary>
    /// 商品库存变更事件
    /// </summary>
    public class ProductStockChangedEvent : DomainEvent<Product>
    {
        /// <summary>
        /// 变更的库存数量
        /// </summary>
        public int QuantityChanged { get; }

        /// <summary>
        /// 库存变更类型（增加或减少）
        /// </summary>
        public StockChangeType ChangeType { get; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="product">商品实体</param>
        /// <param name="quantityChanged">变更的库存数量</param>
        /// <param name="changeType">库存变更类型</param>
        public ProductStockChangedEvent(Product product, int quantityChanged, StockChangeType changeType) : base(product)
        {
            QuantityChanged = quantityChanged;
            ChangeType = changeType;
        }
    }

    /// <summary>
    /// 库存变更类型
    /// </summary>
    public enum StockChangeType
    {
        /// <summary>
        /// 增加库存
        /// </summary>
        Increase,

        /// <summary>
        /// 减少库存
        /// </summary>
        Decrease
    }
}